<template>
  <div class="header">
    <div class="header-left">
      <div class="iconfont back-icon">&#xe624;</div>
    </div>
    <div class="header-input">
      <span class="iconfont">&#xe632;</span>
      请输入游玩景点
    </div>
    <router-link to='/city'>
      <div class="header-right">
        <!-- {{this.$store.state.city}} -->
        <!-- {{this.city}} -->
        {{this.doubleCity}}
        <span class="iconfont arrow-icon">&#xe64a;</span>
      </div>
    </router-link>
  </div>
</template>
<script>
import { mapState, mapGetters } from 'vuex'
export default {
  name: 'HomeHeader',
  computed: {
    // 把vuex里面的city的数据，映射到本组件名为city的计算属性当中
    ...mapState(['city']),
    // 同上
    ...mapGetters(['doubleCity'])
  }
}
</script>

<style lang="stylus" scoped>
/*.86rem 的来由，设计图是86px, 因为是两倍屏，因而应该是43px,又因为reset.css里定义了font-size: 50px*/
/*所以又1rem=html 50px,根据比例43px对应的应该是 .86rem*/
  @import '~styles/varibles.styl'
  .header
    display: flex
    line-height: $headerHeight
    background: $bgColor
    color: #fff
    .header-left
      width: .64rem
      float: left
      .back-icon
        text-align: center
        font-size: .4rem
    .header-input
      flex: 1
      height: .64rem
      line-height: .64rem
      background: #fff
      border-radius: .1rem
      height: .64rem
      margin-top: .12rem
      margin-left: .2rem
      color: #ccc
      padding-left: .2rem
    .header-right
      color: #fff
      min-width: 1.04rem
      padding: 0.1rem
      float: right
      text-align: center
      .arrow-icon
        font-size: .24rem
</style>
